/*
@author: Administrator
@date: 2021/7/27 14:37
@Version: 1.0
@last modifined by : 2021/7/27 14:37
@last Modifined time : 2021/7/27 14:37
*/

import { getRequest, postRequest } from '@/api/request';

// 无印良品官网
const MUJI = 'https://www.muji.com.cn';
const baseMUJI = '/cn/ecapi/maps/ec';

const categories = () => {
  return getRequest(`${MUJI + baseMUJI}/categories`, {
    'X-App-Source': 1,
    'X-Sign': 'A4F7F62DAA09009CB01D491A465FEE66',
  });
}

const preferentialstatus = () => {
  return postRequest(`${MUJI + baseMUJI}/commodity/preferentialstatus`, {}, {
    'X-App-Source': 1,
    'X-Sign': 'A4F7F62DAA09009CB01D491A465FEE66',
  });
}

// 句子控
/*
* timestamp： 动态参数
* sign: 动态参数
* start: 动态参数, 15 的倍数
* */
const funny = () => {
  return getRequest(`https://api.juzikong.com/n0/tags/%E7%AC%91%E8%AF%9D/posts?start=0&limit=15&timestamp=${+new Date()}&sign=9e662107a17251a1bc5612e92d45e0c62bfda81e`, {
    method: 'GET',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    // 'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"',
    // 'origin': 'https://www.juzikong.com',
    // 'referer': 'https://www.juzikong.com/',
  });
}
// fetch( {
//   method: 'GET',
//   headers: {
//     'sec-ch-ua-mobile': '?0',
//     'sec-ch-ua-platform': 'macOS',
//     'sec-fetch-dest': 'empty',
//     'sec-fetch-mode': 'cors',
//     'sec-fetch-site': 'same-site',
//     ':path': '/n0/collections/7fb81d74-6b75-4f71-866b-31a5896b6ceb/posts?start=0&limit=10&timestamp=1657876148511&sign=af2bb1fc59e06680560b9b5f5639780d7e49f96c',
//     ':authority': 'api.juzikong.com',
//     'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"',
//     'origin': 'https://www.juzikong.com',
//     'referer': 'https://www.juzikong.com/',
//   },
//   mode: 'cors',
// })

export {
  categories,
  preferentialstatus,
  funny
}
